using System;
using UnityEngine;



/// <summary>
/// 
/// </summary>
public class DoorComponent : MonoBehaviour
{
    AreaInteraction _areaInteraction;

    private void Start()
    {
        _areaInteraction = transform.GetComponent<AreaInteraction>();
        _areaInteraction.OnInteractionTriggered += OnCubeChanged;
    }

    private void OnCubeChanged()
    {
        float r = UnityEngine.Random.Range(0, 1f);
        float g = UnityEngine.Random.Range(0, 1f);
        float b = UnityEngine.Random.Range(0, 1f);


        transform.GetComponent<Renderer>().material.SetColor("_BaseColor", new Color(r, g, b));
    }
}
